import { getPermission } from '@/api/api'
import { login, getButton } from '@/service/api/common'
import { setItem, getItem, removeAllItem } from '@/utils/storage'
import { TOKEN, USERINFO, EMPPOSITION } from '@/constant'
import { setTimeStamp } from '@/utils/auth'
import { formatPermissionList, lowerCase } from '@/utils/index'
import router, { resetRouter } from '@/router'
import { ElMessage } from "element-plus";
import { useStore } from "vuex";

export default {
    namespaced: true,
    state: () => ({
        position: '',
        dept: '',
        page: '',
        page_size: '',
    }),
    mutations: {
        setPosition(state, position) {
            state.position = position
        },
        setDept(state, dept) {
            state.dept = dept
        },
        setPage(state, page) {
            state.page = page
        },
        setPageSize(state, page_size) {
            state.page_size = page_size
        }
    },
    actions: {
        beforeSet(context,searchForm) {
            this.commit('skip/setPosition', searchForm.value.position);
            this.commit('skip/setDept', searchForm.value.dept);
            this.commit('skip/setPage', searchForm.value.page);
            this.commit('skip/setPageSize', searchForm.value.page_size);
        },
        claer(){
            this.commit('skip/setPosition', '');
            this.commit('skip/setDept', '');
            this.commit('skip/setPage', '');
            this.commit('skip/setPageSize', '');
        }
    }
}

